package org.springframework.license.configure;

import org.springframework.license.listener.LicenseCheckListener;
import org.springframework.license.properties.LicenseProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @Title LicenseConfigure
 * @Author zhijun.Guo
 * @Email tiankong061015@163.com
 * @Time 2024/9/2 20:18
 * @Description
 */
@Configuration
@EnableConfigurationProperties(LicenseProperties.class)
//取消开关, 引用该starter后, 强制进行授权校验
//@ConditionalOnProperty(prefix = "license", name = "enable", havingValue = "true")
public class LicenseConfigure {

    @Resource
    private LicenseProperties licenseProperties;

    @Bean(name = "licenseCheckListener")
    public LicenseCheckListener licenseService() {
        return new LicenseCheckListener(licenseProperties);
    }

}
